<?php

/**
 * UsuarioPostulante filter form base class.
 *
 * @package    sayd
 * @subpackage filter
 * @author     hylianred
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUsuarioPostulanteFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombres_postulante'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'apellidos_postulante'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'rut_postulante'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'contrasenia_postulante' => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fecha_nacimiento'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'sexo_postulante'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'email_postulante'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'semestres_cursados'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'primera_asignatura'     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'segunda_asignatura'     => new sfWidgetFormFilterInput(),
      'tercera_asignatura'     => new sfWidgetFormFilterInput(),
      'fecha_postulacion'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'id_carrera'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Carrera'), 'add_empty' => true)),
      'razones_postulacion'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'nombres_postulante'     => new sfValidatorPass(array('required' => false)),
      'apellidos_postulante'   => new sfValidatorPass(array('required' => false)),
      'rut_postulante'         => new sfValidatorPass(array('required' => false)),
      'contrasenia_postulante' => new sfValidatorPass(array('required' => false)),
      'fecha_nacimiento'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'sexo_postulante'        => new sfValidatorPass(array('required' => false)),
      'email_postulante'       => new sfValidatorPass(array('required' => false)),
      'semestres_cursados'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'primera_asignatura'     => new sfValidatorPass(array('required' => false)),
      'segunda_asignatura'     => new sfValidatorPass(array('required' => false)),
      'tercera_asignatura'     => new sfValidatorPass(array('required' => false)),
      'fecha_postulacion'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'id_carrera'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Carrera'), 'column' => 'id_carrera')),
      'razones_postulacion'    => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('usuario_postulante_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'UsuarioPostulante';
  }

  public function getFields()
  {
    return array(
      'id_postulante'          => 'Number',
      'nombres_postulante'     => 'Text',
      'apellidos_postulante'   => 'Text',
      'rut_postulante'         => 'Text',
      'contrasenia_postulante' => 'Text',
      'fecha_nacimiento'       => 'Date',
      'sexo_postulante'        => 'Text',
      'email_postulante'       => 'Text',
      'semestres_cursados'     => 'Number',
      'primera_asignatura'     => 'Text',
      'segunda_asignatura'     => 'Text',
      'tercera_asignatura'     => 'Text',
      'fecha_postulacion'      => 'Date',
      'id_carrera'             => 'ForeignKey',
      'razones_postulacion'    => 'Text',
    );
  }
}
